package anotationDemo;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Demo1 {
	@Ano1(id = 1, description = "good")
	public void t1(String hh) {

	}
	
	public void t2(List<Object> list, Class<?> clazz) {
		for (Method method : clazz.getDeclaredMethods()) {
			//判断是否为此注解
			method.isAnnotationPresent(Ano1.class);
			//返回这个注解
			Ano1 ano1 = method.getAnnotation(Ano1.class);
			if (ano1 != null) {
				System.out.println(ano1.id() + ano1.description());
			}
		}
	}

	public static void main(String[] args) {
		List<Object> list = new ArrayList<Object>();
		Collections.addAll(list, 1, 2, 3, 4);
		Demo1 demo1 = new Demo1();
		demo1.t2(list, Demo1.class);
	}

}
